package com.example.springboot_demo.service;

import com.example.springboot_demo.mappers.UserMapper;
import com.example.springboot_demo.pojo.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @BelongsProject: springboot_demo
 * @BelongsPackage: com.example.springboot_demo.service
 * @Author: 江岸
 * @CreateTime: 2020-07-28 14:06
 * @Description:
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private static Logger log = LoggerFactory.getLogger(UserServiceImpl.class);

    @Override
    public List<User> query() {
        return userMapper.query();
    }

    @Override
    public int add(User user) {
        int add = userMapper.add(user);
        //主键生成策略后，从user对象中拿到id
        log.info(user.getId()+"-------------------------");
        return user.getId();
    }

    public static void main(String[] args) {
        Integer i = 1;
        System.out.println(new Integer(1).equals(i));
    }
}
